#ifndef _STRAWGUI_TEXTURE_RESOURCE_STRETCH_H_
#define _STRAWGUI_TEXTURE_RESOURCE_STRETCH_H_

#include "sSaveable.h"
#include "sConfig.h"

#ifdef _EDITOR
#include "sRTTIObject.h"
#endif

namespace sgui
{
namespace res
{    

enum EStretchMode {
	ESM_STRETCH = 0,
	ESM_REPEAT_BEGIN,
	ESM_REPEAT_CENTER,
	ESM_REPEAT_END,
	ESM_FILL_BEGIN,
	ESM_FILL_CENTER,
	ESM_FILL_END
};

enum EStretchDivider
{
	ESD_FIRST = 0,
	ESD_SECOND,
	ESD_COUNT
};

class sTextureResourceStretch: public sSaveable
#ifdef _EDITOR
, public rtti::sObject
#endif
{
private:

	f32 m_horisontalDividers[ESD_COUNT];
	f32 m_verticalDividers[ESD_COUNT];

	struct sStretchCenter
	{
		EStretchMode horisontal;
		EStretchMode vertical;
		sStretchCenter() :
			horisontal(ESM_STRETCH),
			vertical(ESM_STRETCH)
		{

		}
	} m_center;

	EStretchMode m_top;
	EStretchMode m_bottom;
	EStretchMode m_left;
	EStretchMode m_right;

public:
	
	void setFirstHorisontalDivider(const f32& value)					{ m_horisontalDividers[ESD_FIRST] = value; }
    const f32& getFirstHorisontalDivider() const						{ return m_horisontalDividers[ESD_FIRST]; }
	void setSecondHorisontalDivider(const f32& value)					{ m_horisontalDividers[ESD_SECOND] = value; }
    const f32& getSecondHorisontalDivider() const						{ return m_horisontalDividers[ESD_SECOND]; }

	void setFirstVerticalDivider(const f32& value)						{ m_verticalDividers[ESD_FIRST] = value; }
    const f32& getFirstVerticalDivider() const							{ return m_verticalDividers[ESD_FIRST]; }
	void setSecondVerticalDivider(const f32& value)						{ m_verticalDividers[ESD_SECOND] = value; }
    const f32& getSecondVerticalDivider() const							{ return m_verticalDividers[ESD_SECOND]; }
	
	void setCenterHorisontalStretchMode(const EStretchMode& value)		{ m_center.horisontal = value; }
    const EStretchMode& getCenterHorisontalStretchMode() const			{ return m_center.horisontal; }
	void setCenterVerticalStretchMode(const EStretchMode& value)		{ m_center.vertical = value; }
	const EStretchMode& getCenterVerticalStretchMode() const			{ return m_center.vertical; }

	void setTopStretchMode(const EStretchMode& value)					{ m_top = value; }
    const EStretchMode& getTopStretchMode() const						{ return m_top; }
	void setBottomStretchMode(const EStretchMode& value)				{ m_bottom = value; }
    const EStretchMode& getBottomStretchMode() const					{ return m_bottom; }
	void setLeftStretchMode(const EStretchMode& value)					{ m_left = value; }
    const EStretchMode& getLeftStretchMode() const						{ return m_left; }
	void setRightStretchMode(const EStretchMode& value)					{ m_right = value; }
    const EStretchMode& getRightStretchMode() const						{ return m_right; }

public:

	sTextureResourceStretch();

	void save(db::Record& file) const;
	void load(const db::Record& file);
	void clear();
#ifdef _EDITOR
	void exportRTTI(rtti::sInfoList& list);
#endif
};

};
};

#endif